package dshop.model.member;

import java.util.ArrayList;
import java.util.List;

import appbase.jfinal.ext.BaseModel;

public class MemberGeneralInfo extends BaseModel<MemberGeneralInfo>{
	
	private static final long serialVersionUID = -6967680902549117464L;
	
	public static final MemberGeneralInfo dao = new MemberGeneralInfo();

	
	public static List<String> findPhoneList(List<Integer> userIdList) 
	{
		if (userIdList == null || userIdList.isEmpty())
		{
			return new ArrayList<>();
		}
		
		String sql = " select * from member_general_info where account_id in (??) ";
		sql = dao.buildSqlHasIn(sql, userIdList);
		List<MemberGeneralInfo> accountList = dao.find(sql);
		if (accountList == null || accountList.isEmpty())
		{
			return new ArrayList<String>();
		}
		
		List<String> phoneList = new ArrayList<>();
		for (MemberGeneralInfo member : accountList) 
		{
			String phone = member.getStr("phone");
			if (phone != null && !phone.isEmpty())
			{
				phoneList.add(phone);
			}
		}
		return phoneList;
	}
	
}
